package com.hsck.order.kds.base.isnoam.view

import android.os.Bundle
import android.view.LayoutInflater
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding


abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {

    private var _binding: VB? = null
    protected val binding: VB
        get() = _binding!!

    override fun onCreate(savedInstanceState: Bundle?) {
        window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
        super.onCreate(savedInstanceState)
        _binding = inflateBinding(layoutInflater)
        setContentView(binding.root)
//        XLog.e(this.javaClass.simpleName)
        receiveData()
        registerObserver()
        initData()
        initListener()
    }

    open fun initListener() {}
    open fun initData() {}

    protected abstract fun inflateBinding(inflater: LayoutInflater): VB
    override fun onDestroy() {
        super.onDestroy()
        _binding = null
    }

    open fun registerObserver() {}
    open fun receiveData() {}
}
